<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .red{
            background-color: red;
        }
        .green{
            background-color: green;
        }
    </style>
    <script>
        function run1(x) {
            x.className="red";
        }
        function run2(x) {
            x.className="green";
        }
    </script>
</head>
<body>
<input type="text" onfocus="run1(this)" onblur="run2(this)"/>
<input type="text" onfocus="run1(this)" onblur="run2(this)"/>
<input type="text" onfocus="run1(this)" onblur="run2(this)"/>
</body>
</html>